package com.sdy.dao.redis;

import com.sdy.dao.mysql.OverViewDao;
import com.sdy.po.OverView;
import com.sdy.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.*;

@Repository
public class OverViewDaoImpl implements OverViewDao {

    @Autowired
    RedisUtil redisUtil;

    @Override
    public Boolean addOverView(OverView overView, String key) {
        System.out.println(overView);
        return redisUtil.set(key,overView);
    }

    @Override
    public List<OverView> findOverViewByKeys(List<String> keyList) {
        List<OverView> overViewList = new ArrayList<>();
        List<Object> objectList = redisUtil.getByPipline(keyList);
        for (Object object:objectList) {
            OverView overView = (OverView) object;
            overViewList.add(overView);
        }
        System.out.println(overViewList);
        return overViewList;
    }

    @Override
    public OverView findOverViewByKey(String key) {
        return null;
    }

    @Override
    public void deletOverViewById(Integer id) {

    }

    @Override
    public void updateOverView(OverView OverView) {

    }

    @Override
    public List<OverView> findAllOverView() {
        return null;
    }

    @Override
    public Boolean ifHasKey(String key) {
        return redisUtil.hasKey(key);
    }

    @Override
    public void setAllOverView(List<OverView> OverViewList) {

    }
}
